/* AI建议弹窗样式 */
.ai-advice-modal .ant-modal-body {
  height: 60vh;
  overflow-y: auto;
  padding: 24px;
  background: #fff;
  border-radius: 8px;
  /* 隐藏滚动条但保持滚动功能 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.ai-advice-modal .ant-modal-body::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

/* 打字机文本样式 */
.typewriter-text {
  font-size: 14px;
  line-height: 1.8;
  color: #2d3748;
  white-space: pre-wrap;
  word-wrap: break-word;
  padding: 16px;
  background: #f7fafc;
  border-radius: 8px;
  margin: 0;
}
.typewriter-text {
  /* 添加滚动条样式 */
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.typewriter-text::-webkit-scrollbar {
  width: 6px;
}

.typewriter-text::-webkit-scrollbar-track {
  background: transparent;
}

.typewriter-text::-webkit-scrollbar-thumb {
  background-color: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}
.ai-chat-trigger {
  position: fixed;
  right: 10px;
  bottom: 40px;
  width: 60px;
  height: 60px;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 999;
}

.ai-chat-trigger:hover {
  transform: scale(1.1);
}

.ai-chat-trigger img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Modal 样式 */
.ai-chat-modal {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-modal .ant-modal {
  top: 50% !important;
  transform: translateY(-50%) !important;
  margin: 0 auto;
  padding-bottom: 0;
}

.ai-chat-modal .ant-modal-content {
  border-radius: 12px;
  overflow: hidden;
  padding: 0;
  max-height: 80vh; /* 限制最大高度 */
}

/* Modal 内容区域样式 */
.ai-chat-modal .ant-modal-body {
  height: 70vh; /* 增加高度以适应屏幕 */
  overflow-y: auto;
  padding: 0;
  background: #fff;
  border-radius: 8px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  margin: 0; /* 移除外边距 */
}

/* Modal 标题样式 */
.modal-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.title-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

/* 聊天布局 */
.chat-layout {
  display: flex;
  height: 70vh;
  background: #fff;
  position: relative;
}

/* 侧边栏样式 */
.chat-sidebar {
  width: 250px;
  border-right: 1px solid #e8e8e8;
  display: flex;
  flex-direction: column;
  background: #f7f7f7;
  transition: all 0.3s ease;
}

@media screen and (max-width: 768px) {
  .chat-sidebar {
    width: 200px;
  }
}

@media screen and (max-width: 576px) {
  .chat-sidebar {
    width: 180px;
  }
}

.new-chat-btn {
  margin: 16px;
  height: 40px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #1890ff;
  border: none;
  border-radius: 8px;
  transition: all 0.3s;
}

.new-chat-btn:hover {
  background: #40a9ff;
  transform: translateY(-1px);
}

/* 历史记录样式优化 */
.chat-history {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  margin-bottom: 16px;
}

.history-title {
  padding: 16px;
  color: #666;
  font-size: 14px;
  font-weight: 500;
}

.history-item {
  display: flex;
  align-items: center;
  padding: 12px;
  margin: 4px 0;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  color: #666;
}

.history-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 32px); /* 减去图标的宽度 */
}

.history-item:hover {
  background: #e6f7ff;
}

.history-item.active {
  background: #e6f7ff;
  color: #1890ff;
}

.history-item .anticon {
  margin-right: 8px;
  font-size: 16px;
}

/* 主聊天区域 */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #fff;
  overflow: hidden; /* 防止内容溢出 */
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 60vh;
}

/* 聊天消息样式 */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: #f8f9fa;
  /* 隐藏滚动条但保持滚动功能 */
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE and Edge */
}

.chat-messages::-webkit-scrollbar {
  display: none; /* Chrome, Safari and Opera */
}

/* 调整现有的聊天消息样式 */
.message-wrapper {
  margin-bottom: 20px;
}

/* 消息气泡通用样式 */
.message {
  max-width: 80%;
  margin: 8px 0;
  padding: 12px 16px;
  border-radius: 12px;
  position: relative;
  line-height: 1.6;
}

/* 用户消息样式 */
.message.user {
  background: #1890ff;
  color: white;
  margin-left: auto;
  border-top-right-radius: 4px;
}

/* AI消息样式 */
.message.ai {
  background: white;
  color: #333;
  margin-right: auto;
  border-top-left-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.ai-response {
  display: flex;
  align-items: flex-start;
  background: #f9f9f9;
  border-radius: 8px;
  padding: 16px;
}

.ai-avatar {
  width: 36px;
  height: 36px;
  margin-right: 12px;
  border-radius: 50%;
  position: absolute;
  left: -40px;
  top: 0;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.ai-content {
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
}

/* 输入框容器样式优化 */
.chat-input-container {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  padding: 16px;
  border-top: 1px solid #e8e8e8;
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 40px;
  resize: none;
}

.send-button {
  height: 40px;
  padding: 0 24px;
  border-radius: 8px;
  background: #1890ff;
  white-space: nowrap;
}
